package ${basePackage}.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.itigger.commons.document.ApiConfig;
import cn.itigger.commons.document.Status;
import cn.itigger.commons.util.Criteria;
import cn.itigger.commons.document.ApiParam;
import ${basePackage}.domain.${className}VO;
import ${basePackage}.service.${className}Service;
import cn.itigger.commons.util.Page;
import cn.itigger.commons.util.WebUtils;

@Controller
@RequestMapping("${prefix}${lowerName}")
public class ${className}Controller extends BaseController {

	@Resource
	private ${className}Service ${lowerName}Service;
	
	@ApiConfig(desc = "编辑${tableComment}", author = "lwp", status = Status.done)
	@ResponseBody
	@RequestMapping(value = { "edit" }, method = {RequestMethod.POST})
	public String edit(${className}VO ${lowerName}VO) {
		return WebUtils.toJson(request, response, ${lowerName}Service.edit(${lowerName}VO));
	}
	
	@ApiConfig(desc = "删除${tableComment}", author = "lwp", status = Status.done)
	@ResponseBody
	@RequestMapping(value = { "delete" }, method = {RequestMethod.POST })
	public String delete(@ApiParam(name="编号")Integer id) {
		return WebUtils.toJson(request, response, ${lowerName}Service.delete(id));
	}
	
	@ApiConfig(desc = "查询${tableComment}列表", author = "lwp", status = Status.done)
	@ResponseBody
	@RequestMapping(value = { "list" }, method = { RequestMethod.GET,RequestMethod.POST })
	public String list(@ApiParam(includes = { "curPage", "pageSize" }) Page page,Criteria criteria) {
		criteria.setPage(page);
		return WebUtils.toJson(request, response, ${lowerName}Service.list(criteria));
	}

	@ApiConfig(desc = "查询${tableComment}详情", author = "lwp", status = Status.done)
	@ResponseBody
	@RequestMapping(value = { "get" }, method = { RequestMethod.GET,RequestMethod.POST })
	public String get(@ApiParam(name="编号")Integer id) {
		return WebUtils.toJson(request, response, ${lowerName}Service.get(id));
	}
	
}
